package net.bblot.lottery.api.request;

import android.content.Context;
import android.os.Handler;

import com.google.gson.annotations.SerializedName;

import net.bblot.lottery.PackegeConfig;
import net.bblot.lottery.api.ApiResponseListener;
import net.bblot.lottery.api.bean.PackageInfo;
import net.bblot.lottery.api.task.HttpTask;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lottery on 2016/1/6.
 */
public class GetVersion {


    public static HttpTask getVersionInfo(Context context, String versionName, ApiResponseListener listener) {
        String url = PackegeConfig.Base_url + "/api/system/AppInfo/getapp";
        List<NameValuePair> queryParams = new ArrayList<NameValuePair>();
        queryParams.add(new BasicNameValuePair("versionName",versionName));
        queryParams.add(new BasicNameValuePair("appKey",PackegeConfig.App_key));
        final Handler handler = HttpTask.getHttpHandler(listener);
        return HttpTask.getTask(handler, context, url, HttpTask.HTTP_REQEST_TYPE_GET, queryParams, null, null, null);

    }

    public static class Result {
        private boolean enable;
        @SerializedName("package")
        private PackageInfo packageInfo;

        public boolean isEnable() {
            return enable;
        }

        public void setEnable(boolean enable) {
            this.enable = enable;
        }

        public PackageInfo getPackageInfo() {
            return packageInfo;
        }

        public void setPackageInfo(PackageInfo packageInfo) {
            this.packageInfo = packageInfo;
        }
    }
}
